<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    *{
        margin:0;
        padding:0;
    }
    #cats li{
background-color: pink;
position: relative;
height:40px;
line-height:40px;
color:white;
padding:10px;
    }
    #cats li:after{
        content:'';
        position:absolute;
        bottom:0;
        left:0;
        right:0;
        height:1px;/*有点粗 小数不存在 屏幕有发光元器件组成，
        独立的显示什么颜色*/
        background-color: green;
        /* 变形属性 iphone */
        transform:scaleY(0.5);/*压缩*/
    }
</style>
<body>
<ul id="cats"></ul>
    <script>
        //数组对象
    const cats=[
    {
name:'snicke',
age:2
    },
{
    name:'Hugo',
    age:1
}
,{
    name:'Sunny',
    age:3
}]
//相比技术，（面向机器），面对人类的编程，可读性更好
const oul=document.getElementById('cats');
/*for(let cat of cats){
oul.innerHTML+=`
<li>
    ${cat.name}  --  ${cat.age}
    </li>`
}*/

oul.innerHTML=cats.map((cat) =>{
return `
<li>
    ${cat.name}  --  ${cat.age}
    </li>
    `
 } ) .join(' ');

    </script>
</body>
</html>